# First stage: complete build environment
FROM maven:3.5.0-jdk-8-alpine AS builder
WORKDIR /app
COPY . /app
# add pom.xml and source code
ADD ./pom.xml pom.xml
ADD ./src src/
# package jar
#COPY settings.xml /usr/share/maven/conf/
RUN mvn package -Dmaven.test.skip=true

# Second stage: minimal runtime environment
FROM openjdk:8-jre-alpine
# copy jar from the first stage
COPY --from=builder /app/target/springboot-redis-*.jar /app.jar
ENV JAVA_OPTS=""
ENV PARAMS=""
# run jar
ENTRYPOINT [ "sh", "-c", "java $JAVA_OPTS -jar /app.jar $PARAMS" ]


#启动命令
#docker run -p 8099:9999 -e JAVA_OPTS="-Dspring.profiles.active=dev -Dspring.redis.host=host.docker.internal" +容器号